package com.niuxiaofa.newlaw.Tools;

import android.graphics.Bitmap;
import android.graphics.Matrix;

import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;

import java.security.MessageDigest;


/**
 * <p>文件描述：<p>
 * <p>作者：20200911A<p>
 * <p>创建时间：2020/11/19<p>
 * <p>更改时间：2020/11/19<p>
 * <p>版本号：1<p>
 */
public class RotateTransformation extends BitmapTransformation {


        private float rotateRotationAngle = 0;
        public RotateTransformation(float rotateRotationAngle) {
            this.rotateRotationAngle = rotateRotationAngle;
        }
        @Override
        protected Bitmap transform( BitmapPool pool,  Bitmap toTransform, int outWidth, int outHeight) {
            Matrix matrix = new Matrix();
            matrix.postRotate(rotateRotationAngle);
            return Bitmap.createBitmap(toTransform, 0, 0, toTransform.getWidth(), toTransform.getHeight(), matrix, true);
        }
        @Override
        public void updateDiskCacheKey( MessageDigest messageDigest) {
        }
    }